package com.glorystone.ins.domain;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.Arrays;

/**
 * @author:haoguodong
 * @Date:Created in 17:19 2018/3/14
 */
public @Data @NoArgsConstructor @AllArgsConstructor @Builder class Attachment {

    private Long tid;
    private Integer businessType;
    private Long businessId;
    private String name;
    private String alias;
    private Integer type;
    private String url;
    private Integer sortId;
    private Long createBy;

    @JsonSerialize(using = CustomLocalDateTimeSerializer.class)
    private LocalDateTime createAt;
    private Long updateBy;
    @JsonSerialize(using = CustomLocalDateTimeSerializer.class)
    private LocalDateTime updateAt;
    private Integer delFlag;


    /**
     * params
     */

    private String typeName;

    public enum BusinessTypeEnum {

        /**
         * 渠道
         */
        CHANNEL(1),

        /**
         * 订单
         */
        ORDER(2),

        /**
         * 产品
         */
        PRODUCT(3),

        /**
         * 垫资限额
         */
        ADVANCE_LIMIT(4);

        private int value;

        BusinessTypeEnum(int value) {

            this.value = value;
        }

        public int getValue() {
            return value;
        }
    }


    public enum AttachTypeEnum {
        /**
         * 其他
         * FILE_MAP.put(1, "营业执照");
         * FILE_MAP.put(2, "行业许可证");
         * FILE_MAP.put(3, "法人身份证");
         * FILE_MAP.put(4, "高管身份证");
         * FILE_MAP.put(5, "实际控制人身份证");
         * FILE_MAP.put(6, "身份证复印件");
         * FILE_MAP.put(7, "授信合同");
         */
        BUSINESS_LICENSE(1, "营业执照"),
        INDUSTRY_LICENSE(2, "行业许可证"),
        LEGAL_PERSON_ID_NO(3, "法人身份证"),
        SENIOR_MANAGER_ID_NO(4, "高管身份证"),
        ACTUAL_CONTROLLER_ID_NO(5, "实际控制人身份证"),
        CONTACT_ID_NO(6, "身份证复印件"),
        CREDIT_CONTRACT(7, "授信合同"),
        OTHER(8, "");

        private int value;
        private String content;

        AttachTypeEnum(int value, String content) {
            this.value = value;
            this.content = content;

        }

        public String getContent() {
            return content;
        }
        public int getValue() {
            return value;
        }
    }

    public static void main(String[] args) {

        Arrays.asList(AttachTypeEnum.values()).forEach(i ->{
            if (i.getValue() == 3) {
                System.out.println(i.getContent());
            }
        });


    }
}
